package com.wushijia.designpatterns.observer.jdk;

import com.wushijia.designpatterns.observer.bug.LotteryResult;
import java.util.Observable;

public abstract class EventManagerObservable extends Observable {

  public LotteryResult draw(String uid) {
    LotteryResult lotteryResult = doDraw(uid);        // 需要什么通知就调用什么方法
    //通知所有的观察者
    super.setChanged();
    super.notifyObservers(lotteryResult);
    return lotteryResult;
  }

  protected abstract LotteryResult doDraw(String uid);
}
